﻿@namespace BootstrapBlazor.Components
@typeparam TValue
@inherits BootstrapInputEventBase<TValue>

@if (IsShowLabel)
{
    <BootstrapLabel required="@Required" for="@Id" ShowLabelTooltip="ShowLabelTooltip" Value="@DisplayText" />
}

@if (IsClearable)
{
    <div class="bb-clearable-input">
        @RenderInput
        @if (!IsDisabled && !Readonly)
        {
            <i class="@ClearableIconString" @onclick="OnClickClear"></i>
        }
    </div>
}
else
{
    @RenderInput
}

@code {
    RenderFragment RenderInput =>
    @<input @attributes="@AdditionalAttributes" type="@Type" id="@Id" class="@ClassName"
            readonly="@ReadonlyString" disabled="@Disabled"
            placeholder="@PlaceHolder"
            @bind-value="CurrentValueAsString" @bind-value:event="@EventString" @onblur="@OnBlur" @ref="FocusElement" />;
}
